package util;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by ZQ on 2016/4/21.
 */
public class MySqlite extends SQLiteOpenHelper {


    public MySqlite(Context context) {
        super(context,"READER",null,1);
    }

    public MySqlite(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        //存放文本路径信息
        String sql = "create table txt_tab(" +
                " id integer primary key, " +
                " txtPath text, " +
                " nowPage integer, " +
                " readFlag integer)";
        db.execSQL(sql);

        //存放单页内容的信息
        sql = " create table page_tab(" +
                " id integer primary key, " +
                " txtId integer, " +
                " pageNum integer, " +
                " content text)";
        db.execSQL(sql);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
